import ToolRequest from '@/base/newToolAxios';
import RequestOption from '@/base/RequestOption';
import { getActToolUrl } from '@/base/constant';
const tr = new ToolRequest();

export default class TeamDao {
  /**
   * 根据班级ID列表寻找小组列表
   * @returns
   */
  async findTeamByClassIds(classIds) {
    const ro = new RequestOption();
    return await tr.get(
      getActToolUrl(),
      {
        action: 'findTeamByClassIds',
        classIds: classIds,
        creatorId: 1
      },
      ro
    );
  }

  async addTeam(classId: number, teamName: string) {
    const ro = new RequestOption();
    return await tr.post(
      getActToolUrl(),
      {
        action: 'addTeam',
        classId: classId,
        teamName: teamName
      },
      ro
    );
  }
  async deleteTeam(teamId: number) {
    const ro = new RequestOption();
    return await tr.post(
      getActToolUrl(),
      {
        action: 'deleteTeam',
        teamId: teamId
      },
      ro
    );
  }
  async setTeamLeader(teamId: number, userId: number) {
    const ro = new RequestOption();
    return await tr.post(
      getActToolUrl(),
      {
        action: 'setTeamLeader',
        teamId: teamId,
        userId: userId
      },
      ro
    );
  }
}
